package test.workload;


import test.envset.GlobalState;
import test.log.SqlLog;

/*
 * @ 2023-07-05
 * 工作线程基类
 */
public abstract class Worker implements Runnable {
    protected static String SQL_END = ";\n";
    protected static String INFO_PRE = "--thread";
    protected int id;
    protected GlobalState globalState = null;
    //统计相关，分别表示总计，成功，失败
    protected long[] counter = {0, 0, 0};

    public long[] getCounter() {
        return counter;
    }

    public int getThreadID() {
        return id;
    }

    @Override
    public void run() {
        work();
    }

    //强制日志刷盘
    public synchronized void logFlush(SqlLog log) {
    }

    //执行流程
    public abstract void work();
}
